/**
 * 生成订单号
 * @return 32位订单号
 * @description 例：20230719210103T1689771663R241432 其中T之前表示当前时间为2023年07月19日21时01分03秒，
 * T和R之间的为10位当前时间戳，R之后为6位随机数
 */
export const orderNo = (): string =>{
  const currentDate = new Date()
  const year = currentDate.getFullYear().toString()
  const month = (currentDate.getMonth() + 1).toString().padStart(2, "0")
  const day = currentDate.getDate().toString().padStart(2, "0")
  const hours = currentDate.getHours().toString().padStart(2, "0")
  const minutes = currentDate.getMinutes().toString().padStart(2, "0")
  const seconds = currentDate.getSeconds().toString().padStart(2, "0")
  const timestamp = Math.floor(Date.now() / 1000)
    .toString()
    .padStart(10, "0")
  const random = Math.floor(Math.random() * 1000000)
    .toString()
    .padStart(6, "0")
  return (
    year +
    month +
    day +
    hours +
    minutes +
    seconds +
    "T" +
    timestamp +
    "R" +
    random
  )
}
